<?php
require_once('../init.php');
require(CLASS_PATH.'/phprpc/php/phprpc_server.php');
define('SSO_ENC_KEY','bawbaw_hu_key');

function login($sso_info){
	//print_r($sso_info);
	$serialize_user = $sso_info['info'];
	$time = $sso_info['time'];
	$sign = $sso_info['sign'];
	$verify_sign = md5(SSO_ENC_KEY . $serialize_user . $time);
	if($verify_sign == $sign){
		$_SESSION["user"] = unserialize($serialize_user);
	}else{
		return 1;
	}
	return 4;
}

function logout(){
	unset($_SESSION["user"]);
	session_unset();
	session_destroy();
	return 6;
}

$phprpc=new PHPRPC_Server();
$phprpc->add('login');
$phprpc->add('logout');
$phprpc->start();
?>